import { request } from "@/utils/http";

export function createOrder(data: any) {
    return request({
      method: 'POST',
      url: '/materials/api/client/order/create',
      data
    });
}

export function previewOrder(data: any) {
    return request({
      method: 'POST',
      url: '/materials/api/client/order/preview',
      data
    });
}

export function payOrder(data: any) {
    return request({
      method: 'POST',
      url: '/materials/api/client/order/payOrder',
      data
    });
}


export function getOrderDetails(params: any) {
  return request({
    method: 'GET',
    url: '/materials/api/client/order/details',
    params
  });
}

export function pollingOrderStates(data: any) {
    return request({
      method: 'POST',
      url: '/materials/api/client/order/pollingOrderStatus',
      data
    });
}

export function getOrderList(params: any) {
  return request({
    method: 'GET',
    url: '/materials/api/client/order/page',
    params
  });
}

export function cancelOrder(data: any) {
  return request({
    method: 'POST',
    url: '/materials/api/client/order/cancelOrder',
    data
  });
}

export function confirmReceipt(data: any) {
  return request({
    method: 'POST',
    url: '/materials/api/client/order/confirmReceipt',
    data
  });
}

export function orderRefundApply(data: any) {
  return request({
    method: 'POST',
    url: '/materials/api/client/order/orderRefundApply',
    data
  });
}

export function deleteOrder(params: any) {
  return request({
    method: 'GET',
    url: '/materials/api/client/order/delete',
    params
  });
}

export function getPayType(params: any) {
  return request({
    method: 'GET',
    url: '/materials/api/client/order/getPayType',
    params
  });
}

export function getTradeType() {
  return request({
    method: 'GET',
    url: '/materials/api/client/order/getTradeType',
  });
}